class User < ActiveRecord::Base
  
  validates_presence_of(:login, :pass, :pass_confirmation)
  validates_confirmation_of(:pass)
  validates_uniqueness_of(:login)
  
  def self.authenticate(login, pass)
    user = self.find_by_login(login)
    if user
      if pass!=user.pass
        user = nil
      else        
      end
    end
    user
  end
  
end
